<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Insert.aspx.cs" Inherits="pages_admin_reservation_Insert" MasterPageFile="~/template/template.master"%>

<%@ Register Namespace="UTS.Controls" TagPrefix="uts" %>

<asp:Content ContentPlaceHolderID="MainContent" runat="server">
    <asp:PlaceHolder ID="ReservationPlaceHolder" runat="server">
    
<asp:UpdateProgress 
    AssociatedUpdatePanelID="ReservationEditingPanel"
    ID="ReservationEditingPanelProgress"
    runat="server">
<ProgressTemplate>
    <asp:Image ID="ProgressBar" runat="server" ImageUrl="~/template/images/indicator.gif" />
</ProgressTemplate>    
</asp:UpdateProgress>
    
<asp:UpdatePanel ID="ReservationEditingPanel" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <table>
            <tr>
                <td>
                    Semester
                </td>
                <td>
                    <uts:SemesterDropDownList ID="Reservation_SemesterDropDownList" runat="server" DataTextField="SemesterName" DataValueField="SemesterId"/>    
                </td>
            </tr>
            <tr>
                <td>
                    Cohort
                </td>
                <td>
                    <uts:CohortDropDownList ID="Reservation_CohortDropDownList" runat="server" 
                        AutoPostBack="true"
                        DataTextField="CohortName" DataValueField="CohortId"
                        OnSelectedIndexChanged="Reservation_CohortDropDownList_SelectedIndexChanged"/>    
                </td>
            </tr>            
            <tr>
                <td>
                    Module
                </td>
                <td>
                    <uts:ModuleDropDownList 
                                    ID="Reservation_ModuleDropDownList" 
                                    runat="server" 
                                    AutoPostBack="true"
                                    DataTextField="ModuleName" 
                                    DataValueField="ModuleId"
                                    OnSelectedIndexChanged="Reservation_ModuleDropDownList_SelectedIndexChanged"/>    
                </td>
            </tr>                        
            <tr>
                <td>
                    Lecturer
                </td>
                <td>
                    <uts:LecturerDropDownList 
                                    ID="LecturerDropDownList" 
                                    runat="server" 
                                    AutoPostBack="true"
                                    DataTextField="LecturerName" 
                                    DataValueField="LecturerId" />
                </td>
            </tr>               
            <tr>
                <td colspan="2">
                    <table>
                        <tr>
                            <td></td>
                            <td>
                                Class Event
                            </td>
                            <td>
                                Start Time    
                            </td>
                            <td>
                                End Time
                            </td>
                        </tr>
                        <tr>
                        <td colspan="2">
                        <asp:Repeater ID="ClassEventRepeater" runat="server" OnItemCreated="ClassEventRepeater_ItemCreated">
                            <ItemTemplate>
                                <tr>
                                    <td>
                                        <asp:HiddenField ID="ClassEventId" runat="server" Value=<%# Eval("TimetableEventId")%> />
                                    </td>
                                    <td>
                                        <asp:HiddenField ID="ClassEventTypeId" runat="server"  Visible="true"/>
                                        <asp:CheckBox ID="ClassEventReserved" runat="server"/>
                                    </td>                                
                                    <td>
                                        <asp:Literal ID="ClassEventTypeNameLiteral" runat="server"/>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="ClassEventStartTimeTextbox" runat="server" />
                                    </td>
                                    <td>
                                        <asp:TextBox ID="ClassEventStopTimeTextbox" runat="server" />
                                    </td>                                    
                                    <td>
                                        <uts:CourseDayDropDownList ID="CourseDayDropDownList" runat="server" DataTextField="CourseDayName" DataValueField="CourseDayId" AutoPostBack="false"/>
                                    </td>                                                                                                            
                                    <td>
                                        <uts:RoomDropDownList ID="ClassEventRoomDropDown" runat="server" DataTextField="RoomName" DataValueField="RoomId"/>
                                    </td>                                                                        
                                </tr>                            
                            </ItemTemplate>
                        </asp:Repeater>
                        
                        
                        </td>
                        </tr>
                        <tr>
                            <td colspan="2"><asp:Button ID="SaveReservation" runat="server" OnClick="SaveReservations" text="Save"/></td>
                            <td colspan="2"><asp:Button ID="BackButton" runat="server" text="Back" PostBackUrl="~/pages/admin/reservation/List.aspx"/></td>
                        </tr>
                        
                    </table>
                </td>                
            </tr>                                    
        </table>
    </ContentTemplate>

    <Triggers>
       <asp:AsyncPostBackTrigger ControlID="Reservation_CohortDropDownList" EventName="SelectedIndexChanged" />
       <asp:AsyncPostBackTrigger ControlID="Reservation_ModuleDropDownList" EventName="SelectedIndexChanged" />       
    </Triggers>       
</asp:UpdatePanel>


</asp:PlaceHolder>
</asp:Content>